#include "stdafx.h"
#include "resource.h"
#include "TestFilterPatternDlg.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


CTestFilterPatternDlg::CTestFilterPatternDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestFilterPatternDlg::IDD, pParent)
{
	m_strTestPath = _T("");
	m_strTestPattern = _T("");
}

void CTestFilterPatternDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT_TEST_PATH, m_strTestPath);
	DDX_Text(pDX, IDC_EDIT_TEST_PATTERN, m_strTestPattern);
}


BEGIN_MESSAGE_MAP(CTestFilterPatternDlg, CDialog)
	ON_BN_CLICKED(IDC_BTN_TEST, OnBtnTest)
END_MESSAGE_MAP()


void CTestFilterPatternDlg::OnCancel() 
{
	CDialog::OnCancel();
}

void CTestFilterPatternDlg::OnOK() 
{
	CDialog::OnOK();
}

void CTestFilterPatternDlg::OnBtnTest() 
{
	if (!UpdateData(TRUE))
	{
		return;
	}

	CString str;

	if( !(m_strTestPath.IsEmpty() && m_strTestPattern.IsEmpty()) )
	{
		str.Format(_T("%s"), PathMatchSpec(m_strTestPath, m_strTestPattern) ? _T("TRUE") : _T("FALSE"));
	}
		
	SetDlgItemText(IDC_STATIC_TEST_RESULTS, str);
}
